﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using DevComponents.DotNetBar;

namespace QLKBNT
{
    public partial class MainForm1 : DevComponents.DotNetBar.Office2007Form //Form
    {
        private int childFormNumber = 0;
        
        
        public MainForm1()
        {
            InitializeComponent();
        }

        private void ShowNewForm(object sender, EventArgs e)
        {
            Form childForm = new Form();
            childForm.MdiParent = this;
            childForm.Text = "Window " + childFormNumber++;
            childForm.Show();
        }

        private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            openFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = openFileDialog.FileName;
            }
        }

        private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            saveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
            if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = saveFileDialog.FileName;
            }
        }

        private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CutToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void CopyToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void PasteToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void ToolBarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //toolStrip.Visible = toolBarToolStripMenuItem.Checked;
        }

        private void StatusBarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //statusStrip.Visible = statusBarToolStripMenuItem.Checked;
        }

        private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.Cascade);
        }

        private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileVertical);
        }

        private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.ArrangeIcons);
        }

        private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form childForm in MdiChildren)
            {
                childForm.Close();
            }
        }

        private void Main_Load(object sender, EventArgs e)
        {
            //KetNoiCSDL Kn = new KetNoiCSDL();
            //Kn.MoKetNoi();
           // this.Hide();
            //DangNhap dn = new DangNhap();
            //dn.Show();
            //Navigation_bar nvbar = new Navigation_bar();
            //nvbar.CloseButtonVisible = false;
            //nvbar.Show(dockPanel, DockState.DockLeft);
            //DangNhap dn = new DangNhap();
            //dn.Show();
            //Tim_ten_form_va_control tim = new Tim_ten_form_va_control();
            //tim.Show(dockPanel, DockState.Document);
            
            this.Hide();
            frmDangNhap dn = new frmDangNhap();
            dn.ShowDialog(this) ;

            //Biến login dùng để kiểm tra việc đăng nhập có hợp lệ không. True là hợp lệ
            if (dn.login == true)
            {
                this.Show();

                PhanQuyen(dn.u);
                dn.Dispose();
            }

            //frmBacSi f = new frmBacSi();
            //f.Show(dockPanel, DockState.Document);
            //frmBenh b = new frmBenh();
            //b.Show(dockPanel, DockState.Document);
        }

        private void fileMenu_Click(object sender, EventArgs e)
        {
           
            
        }

        private void toolsMenu_Click(object sender, EventArgs e)
        {

        }

        private void menuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void dockPanel_ActiveContentChanged(object sender, EventArgs e)
        {

        }
        
        private void PhanQuyen(Main_User u)
        {
            //this.HeThong.Visible = u.Bt00; 
            TạoUserToolStripMenuItem1.Visible = u.Bt00; 
            this.TiepNhan.Visible = u.Bt10; this.KhamBenh.Visible = u.Bt20; this.ThongKe.Visible = u.Bt30; this.TienIch.Visible = u.Bt40;
            this.TiepNhanBN.Visible = u.Bt11;
            //if (u.Nhom == "Admin") 
            //    TạoUserToolStripMenuItem1.Visible=true;
            //else 
            //    TạoUserToolStripMenuItem1.Visible=false;

        }

        private void DSBNDkyKham_Click(object sender, EventArgs e)
        {

        }

        private void KeDonBHYT_Click(object sender, EventArgs e)
        {

        }

     
      
    }
}
